<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery-1.4.4.min.js"></script>
</head>
<body>
<input type="button" value="get" onclick="clickGet()">
<input type="button" value="post" onclick="clickPost()">
</body>
<script type="text/javascript">
    function clickGet() {
        $.ajax({
            type:"GET",
            contentType:"application/json",
            url:"/json/testGet",
            success:function (data) {
                console.log(data)
            },
            error:function (data) {
                console.log("失败")
            }
        });

    }

    function clickPost() {
        var param = {"id":6,"name":"米俞陆","sex":"男"}
        $.ajax({
            type: "POST",
            contentType: "application/json",
            data:JSON.stringify(param),
            url:"/json/testPost",
            success:function (data) {
                alert(data)
            },
            error:function (data) {
                console.log("失败")
            }
        });
    }
</script>
</html>